//
// Created by lenovo on 2017/4/23.
//

#include "Keywords.h"

Keywords::Keywords(string n) : Token(str2Tag(n)) {
    name = n;
}

Tag Keywords::str2Tag(string n) {
    Tag _tag;
    if (n == "int")
        _tag = KW_INT;
    else if (n == "char")
        _tag = KW_CHAR;
    else if (n == "void")
        _tag = KW_VOID;

    return _tag;
}

string Keywords::toString() {
    string s = "";
    return s.append("[keyword(").append(name).append(")]");
}
